package charts ;

import string.Utils;
import charts.series.dots.DefaultDotProperties;
import charts.ScatterBase;
import charts.ScatterBase.SCATTERLINESTRUCT;
import ColorConverter.Color;

class Scatter extends ScatterBase
{
	//var style : SCATTERSTRUCT; // NOTE: redefinition of type not allowed
	public function new ( json: Dynamic )
	{
		super();

		style = {
			values:		[],
			width:		2,
			color:		Hex('#3030d0'),
			text:		'', // <-- default not display a key
			font_size:	12,
			tip:		'[#x#,#y#] #size#',
			axis:		'left'
		};

		//style = _style;
		
		// hack: keep this incase the merge kills it, we'll
		// remove the merge later (and this hack)
		var tmp: Dynamic = Reflect.field(json,'dot-style');
		
		ObjectHelper.merge_2( json, style );
		
		this.default_style = new DefaultDotProperties(
			Reflect.field(json,'dot-style'), ColorConverter.toString(this.style.color), this.style.axis);
		
		this.line_width = style.width;
		//this.color	= string.Utils.get_color( style.color );
		this.color	= ColorConverter.toInt(style.color);
		this.key	= style.text;
		this.font_size	= style.font_size;
		this.circle_size = style.dot_size;
		
		for ( val in style.values )
		{
			if( Reflect.hasField(val,'dot-size') )
				Reflect.setField(val,'dot-size', style.dot_size);
		}
		
		this.values = style.values;

		this.add_values();
	}
}
